package com.ling.pl.autoproject.builder.utils;

import com.ling.pl.autoproject.builder.exporter.Exporter;
import com.ling.pl.autoproject.builder.exporter.MVCExporter;
import com.ling.pl.autoproject.builder.exporter.OneToManyExporter;
import com.ling.pl.autoproject.builder.model.*;
import com.ling.pl.core.commons.utils.AssertHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class AutoProjectUtils {

    static final Log log = LogFactory.getLog(AutoProjectUtils.class);

    /**
     * @param args
     */
    public static void main(String[] args) {
        String resultfolder = "D:/workspace/sources/ling2/ling2.autoproject/result";
//		AutoProjectUtils.execute(resultfolder,TestModel.class);

        OneToManyPojo oneToManyPojo = new OneToManyPojo();
        oneToManyPojo.setOne(revertClass2Pojo(TestModelOne.class));
        oneToManyPojo.addMany(revertClass2Pojo(TestModelMany.class));
//		executeOneToMany(resultfolder,oneToManyPojo);
    }

    /**
     * d7
     *
     * @param resultfolder
     * @param oneToManyPojo
     */
    public static void executeCoreFile(String resultfolder, OneToManyPojo oneToManyPojo) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/VO.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "VO.java", false));
        for (POJOClass child : oneToManyPojo.getMany()) {
            OneToManyPojo childOneToManyPojo = new OneToManyPojo();
            childOneToManyPojo.setSystem(oneToManyPojo.getSystem());
            childOneToManyPojo.setModule(oneToManyPojo.getModule());
            childOneToManyPojo.setOne(child);
            exporters.add(new OneToManyExporter(resultfolder, childOneToManyPojo, "cloud/VO.ftl", "model/" + child.getShortName() + "VO.java", false));
        }

        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }
    /**
     * d7
     *
     * @param resultfolder
     * @param oneToManyPojo
     */
    public static void executeServerFile(String resultfolder, OneToManyPojo oneToManyPojo) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/BaseDaoImpl.ftl", "dao/Base" + oneToManyPojo.getOne().getShortName() + "Dao.java"));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/BaseServiceImpl.ftl", "service/Base" + oneToManyPojo.getOne().getShortName() + "Service.java"));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/BaseController.ftl", "controller/Base" + oneToManyPojo.getOne().getShortName() + "Controller.java"));

        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/DaoImpl.ftl", "dao/" + oneToManyPojo.getOne().getShortName() + "Dao.java", false));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/ServiceImpl.ftl", "service/" + oneToManyPojo.getOne().getShortName() + "Service.java", false));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/Controller.ftl", "controller/" + oneToManyPojo.getOne().getShortName() + "Controller.java", false));
//        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/Entity.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "Entity.java", true));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/VO.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "VO.java", false));
        for (POJOClass child : oneToManyPojo.getMany()) {
            OneToManyPojo childOneToManyPojo = new OneToManyPojo();
            childOneToManyPojo.setSystem(oneToManyPojo.getSystem());
            childOneToManyPojo.setModule(oneToManyPojo.getModule());
            childOneToManyPojo.setOne(child);
//            exporters.add(new OneToManyExporter(resultfolder, childOneToManyPojo, "cloud/Entity.ftl", "model/" + child.getShortName() + "Entity.java", true));
            exporters.add(new OneToManyExporter(resultfolder, childOneToManyPojo, "cloud/VO.ftl", "model/" + child.getShortName() + "VO.java", false));
        }

        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    /**
     * @param resultfolder
     * @param oneToManyPojo
     * @param viewresultfolder
     */
    public static void executeModelFile(String resultfolder, OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/Entity.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "Entity.java", true));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/VO.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "VO.java", false));

        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    /**
     * d7
     *
     * @param resultfolder
     * @param oneToManyPojo
     * @param viewresultfolder TODO
     */
    public static void executeMongoDBServerFile(String resultfolder, OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "mongodb/BaseDaoImpl.ftl", "dao/Base" + oneToManyPojo.getOne().getShortName() + "Dao.java"));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "mongodb/BaseServiceImpl.ftl", "service/Base" + oneToManyPojo.getOne().getShortName() + "Service.java"));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/BaseController.ftl", "controller/Base" + oneToManyPojo.getOne().getShortName() + "Controller.java"));

        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "mongodb/DaoImpl.ftl", "dao/" + oneToManyPojo.getOne().getShortName() + "Dao.java", false));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/ServiceImpl.ftl", "service/" + oneToManyPojo.getOne().getShortName() + "Service.java", false));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/Controller.ftl", "controller/" + oneToManyPojo.getOne().getShortName() + "Controller.java", true));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "mongodb/Entity.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "Entity.java", true));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "cloud/VO.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "VO.java", false));

        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    /**
     * @param resultfolder
     * @param oneToManyPojo
     * @param viewresultfolder
     */
    public static void executeMongoDBModelFile(String resultfolder, OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "mongodb/Entity.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "Entity.java", true));
        exporters.add(new OneToManyExporter(resultfolder, oneToManyPojo, "mongodb/VO.ftl", "model/" + oneToManyPojo.getOne().getShortName() + "VO.java", false));

        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    /**
     * d7
     *
     * @param resultfolder
     * @param oneToManyPojo
     * @param viewresultfolder TODO
     */
    public static void executeAppFile(String resultfolder, OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        exporters.add(new MVCExporter(viewresultfolder + "\\src\\main\\resources\\static\\", oneToManyPojo, "cloud/list.ftl", "views\\" + getViewFolder(oneToManyPojo) + "\\" + oneToManyPojo.getOne().getDeclarationNameFirstLetterLower() + "List.html"));
        exporters.add(new MVCExporter(viewresultfolder + "\\src\\main\\resources\\static\\", oneToManyPojo, "cloud/list_js.ftl", "views\\" + getViewFolder(oneToManyPojo) + "\\" + oneToManyPojo.getOne().getDeclarationNameFirstLetterLower() + "List.js"));
        exporters.add(new MVCExporter(viewresultfolder + "\\src\\main\\resources\\static\\", oneToManyPojo, "cloud/detail.ftl", "views\\" + getViewFolder(oneToManyPojo) + "\\" + oneToManyPojo.getOne().getDeclarationNameFirstLetterLower() + "Detail.html"));
        exporters.add(new MVCExporter(viewresultfolder + "\\src\\main\\resources\\static\\", oneToManyPojo, "cloud/detail_js.ftl", "views\\" + getViewFolder(oneToManyPojo) + "\\" + oneToManyPojo.getOne().getDeclarationNameFirstLetterLower() + "Detail.js"));
        exporters.add(new MVCExporter(viewresultfolder + "\\src\\main\\resources\\static\\", oneToManyPojo, "cloud/service_js.ftl", "views\\" + getViewFolder(oneToManyPojo) + "\\" + oneToManyPojo.getOne().getDeclarationNameFirstLetterLower() + "Service.js"));
        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    /**
     * d7
     *
     * @param resultfolder
     * @param oneToManyPojo
     * @param viewresultfolder TODO
     */
    public static void executeFeignFile(String resultfolder, OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
//        exporters.add(new OneToManyExporter(viewresultfolder, oneToManyPojo, "cloud/BaseFeignService.ftl", "feign\\Base" + oneToManyPojo.getOne().getShortName() + "Service.java", true));
//        exporters.add(new OneToManyExporter(viewresultfolder, oneToManyPojo, "cloud/FeignService.ftl", "feign\\" + oneToManyPojo.getOne().getShortName() + "Service.java", false));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "cloud/list_js.ftl", "views\\" + getViewFolder(oneToManyPojo) + "\\" + oneToManyPojo.getOne().getDeclarationNameFirstLetterLower() + "List.js"));
        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    /**
     * d7
     *
     * @param oneToManyPojo
     * @param viewresultfolder TODO
     */
    public static void executeAntdFile(OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/service.ftl", oneToManyPojo.getModule() + "\\" + "services\\" + oneToManyPojo.getOne().getDeclarationName() + "Service.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/dbtable/index.ftl", oneToManyPojo.getModule() + "\\" + "pages\\" + oneToManyPojo.getOne().getDeclarationName() + "Index.js"));

//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/model.ftl", oneToManyPojo.getModule() + "\\" + "models\\" + "\\" + oneToManyPojo.getOne().getDeclarationName() + ".js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/index.ftl", oneToManyPojo.getModule() + "\\" + "pages\\" + "\\" + oneToManyPojo.getOne().getDeclarationName() + "Index.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/filter.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + oneToManyPojo.getOne().getDeclarationName() + "Filter.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/list.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + oneToManyPojo.getOne().getDeclarationName() + "List.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/modal.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + oneToManyPojo.getOne().getDeclarationName() + "Modal.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/toolbar.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + oneToManyPojo.getOne().getDeclarationName() + "ToolBar.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/form.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + oneToManyPojo.getOne().getDeclarationName() + "Form.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/config/index.ftl", oneToManyPojo.getModule() + "\\" + "config\\" + oneToManyPojo.getOne().getDeclarationName() + "Index.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/config/indexConfig.ftl", oneToManyPojo.getModule() + "\\" + "config\\" + oneToManyPojo.getOne().getDeclarationName() + "IndexConfig.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/config/selectConfig.ftl", oneToManyPojo.getModule() + "\\" + "config\\" + oneToManyPojo.getOne().getDeclarationName() + "SelectConfig.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/selectToolBar.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + oneToManyPojo.getOne().getDeclarationName() + "SelectToolBar.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/select.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + oneToManyPojo.getOne().getDeclarationName() + "Select.js"));
//
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/detail_model.ftl", oneToManyPojo.getModule() + "\\" + "models\\" + oneToManyPojo.getOne().getDeclarationName() + "Detail.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/detail.ftl", oneToManyPojo.getModule() + "\\" + "pages\\" + oneToManyPojo.getOne().getDeclarationName() + "Detail.js"));
//
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/many/index.ftl", oneToManyPojo.getModule() + "\\" + "pages\\", "Index.js"));
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/many/model.ftl", oneToManyPojo.getModule() + "\\" + "models\\", ".js"));


//        for (POJOClass child : oneToManyPojo.getMany()) {
//            if (RelationType.MANY_EMBED.equals(child.getRelation())) {
//                OneToManyPojo childOneToManyPojo = new OneToManyPojo();
//                childOneToManyPojo.setModule(oneToManyPojo.getModule());
//                childOneToManyPojo.setOne(child);
////                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/model.ftl", oneToManyPojo.getModule() + "\\" + "models\\" + "\\" + child.getDeclarationName() + ".js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/index.ftl", oneToManyPojo.getModule() + "\\" + "pages\\" + "\\" + child.getDeclarationName() + "Index.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/filter.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + child.getDeclarationName() + "Filter.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/list.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + child.getDeclarationName() + "List.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/modal.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + child.getDeclarationName() + "Modal.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/toolbar.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + child.getDeclarationName() + "ToolBar.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/form.ftl", oneToManyPojo.getModule() + "\\" + "components\\" + child.getDeclarationName() + "Form.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/config/index.ftl", oneToManyPojo.getModule() + "\\" + "config\\" + child.getDeclarationName() + "Index.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/config/indexConfig.ftl", oneToManyPojo.getModule() + "\\" + "config\\" + child.getDeclarationName() + "IndexConfig.js"));
//
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/detail_model.ftl", oneToManyPojo.getModule() + "\\" + "models\\" + child.getDeclarationName() + "Detail.js"));
//                exporters.add(new MVCExporter(viewresultfolder, childOneToManyPojo, "antd/detail.ftl", oneToManyPojo.getModule() + "\\" + "pages\\" + child.getDeclarationName() + "Detail.js"));
//
//            }else if (RelationType.MANY_DEFAULT.equals(child.getRelation())){
//
//            }
//        }
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/model.ftl", oneToManyPojo.getModule() + "\\" + "models\\" + "\\" , ".js"));
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/index.ftl", oneToManyPojo.getModule() + "\\" + "pages\\" + "\\" ,"Index.js"));
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/filter.ftl", oneToManyPojo.getModule() + "\\" + "components\\" ,"Filter.js"));
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/list.ftl", oneToManyPojo.getModule() + "\\" + "components\\" , "List.js"));
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/modal.ftl", oneToManyPojo.getModule() + "\\" + "components\\" , "Modal.js"));
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/toolbar.ftl", oneToManyPojo.getModule() + "\\" + "components\\" ,"ToolBar.js"));
//        exporters.add(new MVCRelationExporter(viewresultfolder, oneToManyPojo, "antd/form.ftl", oneToManyPojo.getModule() + "\\" + "components\\" , "Form.js"));


        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    /**
     * d7
     *
     * @param oneToManyPojo
     * @param viewresultfolder TODO
     */
    public static void executeAntdDBTableFile(OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/dbtable/config.ftl", "schema\\" + oneToManyPojo.getOne().getDeclarationName().toLowerCase() + ".config.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/dbtable/dataSchema.ftl", "schema\\" + "\\" + oneToManyPojo.getOne().getDeclarationName().toLowerCase() + ".dataSchema.js"));
//        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/dbtable/querySchema.ftl", "schema\\" + "\\" + oneToManyPojo.getOne().getDeclarationName().toLowerCase() + ".querySchema.js"));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/dbtable/config.ftl", oneToManyPojo.getModule() + "\\" + "schema\\" + oneToManyPojo.getOne().getDeclarationName().toLowerCase() + ".config.js"));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/dbtable/dataSchema.ftl", oneToManyPojo.getModule() + "\\" + "schema\\" + oneToManyPojo.getOne().getDeclarationName().toLowerCase() + ".dataSchema.js"));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "antd/dbtable/querySchema.ftl", oneToManyPojo.getModule() + "\\" + "schema\\" + oneToManyPojo.getOne().getDeclarationName().toLowerCase() + ".querySchema.js"));
        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    public static void executeAngularFile(OneToManyPojo oneToManyPojo, String viewresultfolder) {
        List<Exporter> exporters = new ArrayList<Exporter>();
        String oneName = oneToManyPojo.getOne().getDeclarationName().toLowerCase();

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/component.css.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + oneName + ".component.css", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/component.html.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + oneName + ".component.html", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/component.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + oneName + ".component.ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/filter/filter.component.css.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-filter" + "\\" + oneName + "-filter.component.css", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/filter/filter.component.html.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-filter" + "\\" + oneName + "-filter.component.html", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/filter/filter.component.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-filter" + "\\" + oneName + "-filter.component.ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/form/form.component.css.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-form" + "\\" + oneName + "-form.component.css", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/form/form.component.html.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-form" + "\\" + oneName + "-form.component.html", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/form/form.component.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-form" + "\\" + oneName + "-form.component.ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/grid/grid.component.css.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-grid" + "\\" + oneName + "-grid.component.css", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/grid/grid.component.html.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-grid" + "\\" + oneName + "-grid.component.html", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/components/grid/grid.component.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "components\\" + oneName + "-grid" + "\\" + oneName + "-grid.component.ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/views/index/index.component.css.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "views\\" + oneName + "-index" + "\\" + oneName + "-index.component.css", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/views/index/index.component.html.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "views\\" + oneName + "-index" + "\\" + oneName + "-index.component.html", true));
        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/views/index/index.component.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "views\\" + oneName + "-index" + "\\" + oneName + "-index.component.ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/models/model.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "models\\" + oneName + ".ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/services/service.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + "services\\" + oneName + ".service.ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/module.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + oneName + ".module.ts", true));

        exporters.add(new MVCExporter(viewresultfolder, oneToManyPojo, "angular/routes.ts.ftl", oneToManyPojo.getModule() + "\\" + oneName + "\\" + oneName + ".routes.ts", true));

        for (Exporter exporter : exporters) {
            exporter.execute();
        }
    }

    private static String getViewFolder(OneToManyPojo oneToManyPojo) {
        return getViewFolder(oneToManyPojo.getSystem(), oneToManyPojo.getModule());
    }

    private static String getViewFolder(String system, String module) {
        String result = "";
        if (AssertHelper.notEmpty(system)) {
            result = result + File.separator + system;
        }
//		if(AssertHelper.notEmpty(module)){
//			result= result+File.separator+module;
//		}else{
        result = result + File.separator + "temp";//还是生成在临时目录好,防止代码丢失
//		}
        return result;
    }

    public static POJOClass revertClass2Pojo(Class defClass) {
        DefaultPojo result = new DefaultPojo(defClass);
        return result;
    }

    public static POJOClass revertClass2VoPojo(Class defClass) {
        VOPojo result = new VOPojo(defClass);
        return result;
    }
}
